<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="/fuman/css/style.default.css" type="text/css" />
<script language="javascript">
function checkson(sonid){
   if(document.getElementById("son"+sonid) != null){//判断有无子菜单
      //如果有子菜单，则子菜单的所有check状态和父亲一样
      var inputs = document.getElementsByName("shopname");
      for(var i=0;i<inputs.length;i++){
         if(inputs[i].id == "son"+sonid){
            if(document.getElementById("pre"+sonid).checked == true){
               inputs[i].checked = true;
            }else{
               inputs[i].checked = false;;
            }
         }
      }
   }
}
function searchform(){
   var objs = document.getElementsByName("shopname");
   if(objs != null && objs.length > 0){
      var countrynameStr = "";
      for(var i=0;i<objs.length;i++){
         if(objs[i].checked == true){
            if(countrynameStr.length <=0){
               countrynameStr = objs[i].value;
            }else{
               countrynameStr = countrynameStr + ";" + objs[i].value;
            }
         }
      }
      if(window.opener.document.getElementById("shopnameid") != null){
         window.opener.document.getElementById("shopnameid").value = countrynameStr;
         window.close();
      }else{
         alert("页面出错，请联系技术员");
      }
   }
}

</script>
<body class="withvernav">
<div class="bodywrapper">
    <!--pageheader-->
    
    <div id="contentwrapper" class="contentwrapper">
      <div id="basicform" class="subcontent">
          <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
            <colgroup>
            <col class="con1" />
            <col class="con0" />
            </colgroup>
            <thead>
             <tr>
                <td colspan="2"  class="head0"><button type="button" class="submit radius2" id="btn" onClick="searchform()" >确定</button></td>
              </tr>
              <tr>
                
                <td  class="head0"> {{foreach from=$shopname item=li key=key}}
                  <br> <h4> <input type="checkbox" name="shopID[]" id="pre{{$li.0.platfromname}}" value="{{$li.0.platfromname}}" onClick="checkson('{{$li.0.platfromname}}');"  /> {{$key}}</h4>
                  <br>
                  <hr>
                  <br> 
                  {{foreach from=$li name=infolist item=res key=key}}
                  
                  <div style="width:140px; float:left;overflow:hidden; text-overflow:ellipsis; white-space:nowrap;">
                    <input type="checkbox" name="shopname" id="son{{$res.platfromname}}" value="{{$res.name}}" data-text="{{$res.id}}"  />
                    {{$res.name}} </div>
                   {{if $smarty.foreach.infolist.iteration % 7==0}}
                   <br> 
                    {{/if}}
                  &nbsp;&nbsp;{{/foreach}} <br>
                 
                   <br>
                 <div style="clear:both"></div>
                  {{/foreach}} </td>
              </tr>
              <tr>
                <td colspan="2"  class="head0"><button type="button" class="submit radius2" id="btn" onClick="searchform()" >确定</button></td>
              </tr>
            </thead>
          </table>
        <br />
      </div>
      <!--subcontent--> 
      
      <!--subcontent--> 
      
    </div>
    <!--contentwrapper--> 
    
  </div>
  <!-- centercontent --> 
  
</div>
<script>
function checkCountry(){
   if(window.opener.document.getElementById("shopnameid") != null){
      var checkcountryname = window.opener.document.getElementById("shopnameid").value;
      if(checkcountryname.length > 0){
         checkcountryname = ";"+checkcountryname+";";
         var objs = document.getElementsByName("shopname");
         
         if(objs != null && objs.length > 0){
            for(var i=0;i<objs.length;i++){
               if(checkcountryname.indexOf(";"+objs[i].value+";") >= 0){
                  //alert("包含");
                  objs[i].checked = true;
               }
            }
         }
      }
   }
}
checkCountry();
</script>

<!--bodywrapper-->
</body>
</html>